# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DataMigration.V1.Model.IndexEntity do
  @moduledoc """
  Index is not used as an independent entity, it is retrieved as part of a Table entity.

  ## Attributes

  *   `customFeatures` (*type:* `map()`, *default:* `nil`) - Custom engine specific features.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of the index.
  *   `tableColumns` (*type:* `list(String.t)`, *default:* `nil`) - Table columns used as part of the Index, for example B-TREE index should list the columns which constitutes the index.
  *   `tableColumnsDescending` (*type:* `list(boolean())`, *default:* `nil`) - For each table_column, mark whether it's sorting order is ascending (false) or descending (true). If no value is defined, assume all columns are sorted in ascending order. Otherwise, the number of items must match that of table_columns with each value specifying the direction of the matched column by its index.
  *   `type` (*type:* `String.t`, *default:* `nil`) - Type of index, for example B-TREE.
  *   `unique` (*type:* `boolean()`, *default:* `nil`) - Boolean value indicating whether the index is unique.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :customFeatures => map() | nil,
          :name => String.t() | nil,
          :tableColumns => list(String.t()) | nil,
          :tableColumnsDescending => list(boolean()) | nil,
          :type => String.t() | nil,
          :unique => boolean() | nil
        }

  field(:customFeatures, type: :map)
  field(:name)
  field(:tableColumns, type: :list)
  field(:tableColumnsDescending, type: :list)
  field(:type)
  field(:unique)
end

defimpl Poison.Decoder, for: GoogleApi.DataMigration.V1.Model.IndexEntity do
  def decode(value, options) do
    GoogleApi.DataMigration.V1.Model.IndexEntity.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DataMigration.V1.Model.IndexEntity do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
